package cc.mrbird.plan.domain;

import cc.mrbird.common.annotation.ExportConfig;
import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

@Table(name="plan_training")
public class Training implements Serializable {
    /**
     * 单位ID、单位名称、计划类型（此类安全培训）、培训起始时间（年月日）、培训结束时间（年月日）、
     * 培训地点、培训内容、培训机构等。
     其他描述：计划有三种状态：待提交、执行中、已完成。当新建计划保存后进入待提交状态。
     */
    private static final long serialVersionUID = 7780821232635882425L;
    @Id
    @GeneratedValue(generator = "JDBC")
    @Column(name = "training_id")
    private Integer training_id;

    @Column(name = "unit_id")
    @ExportConfig(value = "单位id")
    private Integer unit_id;

    @Column(name = "unit_name")
    @ExportConfig(value = "单位名称")
    private String unit_name;

    @Column(name = "plan_type")
    @ExportConfig(value = "计划类型")
    private String plan_type;

    @Column(name = "training_start_time")
    @ExportConfig(value = "计划开始时间")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date training_start_time;
    @Column(name = "training_end_time")
    @ExportConfig(value = "计划结束时间")
    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
    private Date training_end_time;
    @Column(name = "training_place")
    @ExportConfig(value = "培训地点")
    private String training_place;
    @Column(name = "training_content")
    @ExportConfig(value = "培训内容")
    private String training_content;
    @Column(name = "training_institutions")
    @ExportConfig(value = "培训机构")
    private String training_institutions;
    @Column(name = "training_status")
    private Integer training_status;    //0:待提交、1:执行中、2:已完成
    @ExportConfig(value = "培训状态")
    private String  training_statusStr;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Integer getTraining_id() {
        return training_id;
    }

    public void setTraining_id(Integer training_id) {
        this.training_id = training_id;
    }

    public Integer getUnit_id() {
        return unit_id;
    }

    public void setUnit_id(Integer unit_id) {
        this.unit_id = unit_id;
    }

    public String getUnit_name() {
        return unit_name;
    }

    public void setUnit_name(String unit_name) {
        this.unit_name = unit_name;
    }

    public String getPlan_type() {
        return plan_type;
    }

    public void setPlan_type(String plan_type) {
        this.plan_type = plan_type;
    }

    public Date getTraining_start_time() {
        return training_start_time;
    }

    public void setTraining_start_time(Date training_start_time) {
        this.training_start_time = training_start_time;
    }

    public Date getTraining_end_time() {
        return training_end_time;
    }

    public void setTraining_end_time(Date training_end_time) {
        this.training_end_time = training_end_time;
    }

    public String getTraining_place() {
        return training_place;
    }

    public void setTraining_place(String training_place) {
        this.training_place = training_place;
    }

    public String getTraining_content() {
        return training_content;
    }

    public void setTraining_content(String training_content) {
        this.training_content = training_content;
    }

    public String getTraining_institutions() {
        return training_institutions;
    }

    public void setTraining_institutions(String training_institutions) {
        this.training_institutions = training_institutions;
    }

    public Integer getTraining_status() {
        return training_status;
    }

    public void setTraining_status(Integer training_status) {
        this.training_status = training_status;
    }

    public String getTraining_statusStr() {
        if(training_status==0){
            training_statusStr="待提交";
        }
        if(training_status==1){
            training_statusStr="执行中";
        }
        if(training_status==2){
            training_statusStr="已完成";
        }
        return training_statusStr;
    }

    public void setTraining_statusStr(String training_statusStr) {
        this.training_statusStr = training_statusStr;
    }

    @Override
    public String toString() {
        return "Training{" +
                "training_id=" + training_id +
                ", unit_id=" + unit_id +
                ", unit_name='" + unit_name + '\'' +
                ", plan_type='" + plan_type + '\'' +
                ", training_start_time=" + training_start_time +
                ", training_end_time=" + training_end_time +
                ", training_place='" + training_place + '\'' +
                ", training_content='" + training_content + '\'' +
                ", training_institutions='" + training_institutions + '\'' +
                ", training_status=" + training_status +
                ", training_statusStr='" + training_statusStr + '\'' +
                '}';
    }
}
